package com.lanswon.icc.common.core.vo;

import com.lanswon.icc.common.core.constant.ResultConstant;
import lombok.Data;
import lombok.ToString;

import java.io.Serializable;

/**
 * 统一返回对象
 */
@Data
@ToString
public class Result<T>  implements Serializable {
    private int code;
    private String message;
    private T data;

    public static <T> Result<T> success(T data){
       return new Result (ResultConstant.RESULT_SUCCES,"success",data);
    }

    public static Result success(){
        return success(null);
    }

    public Result(int code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public Result(int code, String message) {
        this.code = code;
        this.message = message;
    }
    public Result() {

    }
    public static void main(String[] args) {

    }
}
